package cn.itsy.dao;

import cn.itsy.pojo.Dept;
import cn.itsy.pojo.Duct;
import cn.itsy.pojo.Emp;
import cn.itsy.pojo.Job;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class Rehireddaoimpl implements Rehireddao {
    @Resource
    private JdbcTemplate jt;

    @Override
    public List<Emp> list(String sql) {
        List<Emp> query = jt.query(sql, new BeanPropertyRowMapper<Emp>(Emp.class));
        return query;
    }

    @Override
    public List<Dept> deptlist(String sql) {
        List<Dept> query = jt.query(sql, new BeanPropertyRowMapper<Dept>(Dept.class));
        return query;
    }

    @Override
    public List<Duct> ductlist(String sql) {
        List<Duct> query = jt.query(sql, new BeanPropertyRowMapper<Duct>(Duct.class));
        return query;
    }

    @Override
    public List<Job> joblist(String sql) {
        List<Job> query = jt.query(sql, new BeanPropertyRowMapper<Job>(Job.class));
        return query;
    }

    @Override
    public void insertEmpHistoryShow(String sql) {
        jt.update(sql);
    }

    @Override
    public void updateEmpHistoryShow(String sql) {
        jt.update(sql);
    }
}
